using DEL.Gzh;
using IBLL.Gzh;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using Web.Models;

namespace Web.Controllers
{
    public class YWLBController : Controller
    {
        IYWLBService _ys = BLLFactory.SetYWLBService();
        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Yw()
        {
            return View();
        }

        public IActionResult YwDetail()
        {
            return View();
        }

        public JsonResult GetByIdToJson(int id)
        {
            if (id == null)
            {
                return Json(new { Result = "Fail" });
            }
            var data = _ys.GetEntityById(id);
            if (data == null)
            {
                return Json(new { Result = "Fail" });
            }
            return Json(data);
        }

        public IList<YWLB> GetAllList()
        {
            return _ys.GetEntitysByLambdaAndSort(o => o.Id > 0, o=>o.SortIndex, true).ToList();
        }

       
    }
}